package com.sphd.restaurantsystem.presenter;


import com.android.volley.VolleyError;
import com.sphd.restaurantsystem.info.PushMoneyInfo;
import com.sphd.restaurantsystem.info.PushScaleInfo;
import com.sphd.restaurantsystem.model.PushMoneyModelImpl;
import com.sphd.restaurantsystem.view.PushMoneyView;

import java.util.List;

/**
 * Created by Hu on 2016/12/12
 */

public class PushMoneyPresenterImpl implements PushMoneyPresenter {
    PushMoneyModelImpl pushMoneyModel;
    PushMoneyView pushMoneyView;

    public PushMoneyPresenterImpl(PushMoneyView pushMoneyView) {
        this.pushMoneyView = pushMoneyView;
        pushMoneyModel=new PushMoneyModelImpl();
    }

    @Override
    public void addData(String url) {
        pushMoneyView.showLoading();
        pushMoneyModel.sendUrl(url,this);
    }

    @Override
    public void sendError(VolleyError error) {
        pushMoneyView.dissLoading();
    }

    @Override
    public void sendRes(List<PushMoneyInfo> pushMoneyInfos, List<PushScaleInfo> scaleInfos, double daytopup, double dayorder0, double dayorder1) {
        pushMoneyView.recRes(pushMoneyInfos,scaleInfos,daytopup,dayorder0,dayorder1);
        pushMoneyView.dissLoading();
    }
}